package com.toivan.mt.model;

import android.content.Context;

import com.google.gson.Gson;
import com.toivan.mt.utils.MtJsonParser;
import com.toivan.sdk.MtSDK;

public class MtMask {

//    public static final MtMask NO_MASK = new MtMask("", "", null, true);
    private String name;
    private String dir;
    private String thumb;
    private boolean downloaded;

    public MtMask(String name, String dir, String thumb, boolean downloaded) {
        this.name = name;
        this.dir = dir;
        this.thumb = thumb;
        this.downloaded = downloaded;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDir() {
        return dir;
    }

    public void setDir(String dir) {
        this.dir = dir;
    }

    public String getThumb() {
        return MtSDK.get().getMaskUrl() + thumb;
    }

    public void setThumb(String thumb) {
        this.thumb = thumb;
    }

    public boolean isDownloaded() {
        return downloaded;
    }

    public void setDownloaded(boolean downloaded) {
        this.downloaded = downloaded;
    }

    public String getUrl() {
        return MtSDK.get().getMaskUrl() + dir + ".zip";
    }

    public void maskDownload(Context context) {
        MtMaskManager manager = MtJsonParser.getInstance().getMaskManager();
        if (manager != null) {
            manager.findMask(this.name).setDownloaded(true);
            MtJsonParser.getInstance().maskDownload( new Gson().toJson(manager));
        }
    }
}
